// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import App from './App';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
import store from './store'
import router from './router';
import mixins from './mixins';
import VDistpicker from 'v-distpicker' // 引入省市选择器
Vue.component('v-distpicker', VDistpicker) // 注册组件
// import VueSocketio from 'vue-socket.io';
// import socketio from 'socket.io-client';
// Vue.use(VueSocketio, socketio('http://127.0.0.1:7001'),store);
Vue.config.productionTip = false
axios.defaults.headers.common['X-CSRF-Token'] = getCookie('csrfToken');
Vue.prototype.$http = axios;
Vue.mixin(mixins)
Vue.use(ElementUI, { size: 'small' });
// Vue.use(ElementUI);
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store
})

function getCookie(name) {
  var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  if (arr = document.cookie.match(reg))
    return unescape(arr[2]);
  else
    return null;
}

function GetQuery(name) {
  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  var r = window.location.search.substr(1).match(reg);
  if (r != null) return unescape(r[2]); return null;
}